﻿<UserControl x:Class="TechNewLogic.GraphIT.Hv.Vertical.DoubleScale"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
		xmlns:Hv="clr-namespace:TechNewLogic.GraphIT.Hv"
		xmlns:MultiLanguage="clr-namespace:TechNewLogic.GraphIT.MultiLanguage"
		xmlns:Core="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
		xmlns:Vertical="clr-namespace:TechNewLogic.GraphIT.Hv.Vertical" mc:Ignorable="d"
		d:DesignHeight="300" d:DesignWidth="300" x:Name="root" Background="Transparent"
		x:ClassModifier="internal">

	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="/TechNewLogic.GraphIT;component/Styles/PopupButton.xaml" />
			</ResourceDictionary.MergedDictionaries>
			<RotateTransform x:Key="rotateLeft" Angle="270" />
		</ResourceDictionary>
	</UserControl.Resources>

	<Grid DataContext="{Binding ElementName=root}">

		<Rectangle Margin="10,0,0,0">
			<Rectangle.Fill>
				<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
					<GradientStop Color="#25909090" Offset="0" />
					<GradientStop Color="#05909090" Offset="1" />
				</LinearGradientBrush>
			</Rectangle.Fill>
		</Rectangle>

		<Grid x:Name="MainElement">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="{Binding LabelWidth}" />
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<!-- UOM Label -->
				<RowDefinition Height="Auto" />
				<!-- NumCurves Indicator -->
				<RowDefinition Height="Auto" />
				<!-- Frei -->
				<RowDefinition Height="1*" />
				<!-- Curve Rectangles -->
				<RowDefinition Height="Auto" />
				<!-- Frei -->
				<RowDefinition Height="1*" />
			</Grid.RowDefinitions>

			<!-- Trenn-Linie -->
			<Rectangle Height="1" VerticalAlignment="Top" Fill="#45909090" Grid.ColumnSpan="2"
					Margin="10,0,3,0" Grid.RowSpan="10" />
			<!-- Trenn-Linie -->
			<Rectangle Height="1" VerticalAlignment="Bottom" Fill="#45909090" Grid.ColumnSpan="2"
					Margin="10,0,3,0" Grid.RowSpan="10" />

			<!-- Scale Labels-->
			<Grid Grid.Column="1" Grid.RowSpan="10">
				<Rectangle Width="1" Fill="{DynamicResource GeneralForeground}"
						HorizontalAlignment="Right" Margin="0,0,2,0" />
				<Grid x:Name="sectionGrid" ClipToBounds="{Binding ClipLabels}" />
				<Grid x:Name="MoveScaleSurface" Background="Transparent" />
			</Grid>

			<!-- Trenn-Linie -->
			<Rectangle Width="1" HorizontalAlignment="Center" Grid.RowSpan="5" Fill="#45909090" />

			<!-- UOM Label -->
			<Grid Background="{DynamicResource GeneralBackground}">
				<TextBlock Text="{Binding Description}"
						Foreground="{DynamicResource GeneralForeground}"
						LayoutTransform="{StaticResource rotateLeft}" HorizontalAlignment="Center"
						Margin="2" />
				<Grid x:Name="DragScaleSurface" Cursor="SizeAll" Background="Transparent" />
			</Grid>

			<!-- Axes Group Counter Control -->
			<Grid x:Name="axesGroupRoot" Margin="0,10,0,0" HorizontalAlignment="Center"
					Visibility="Hidden" Grid.Row="1">

				<VisualStateManager.CustomVisualStateManager>
					<Core:ExtendedVisualStateManager />
				</VisualStateManager.CustomVisualStateManager>

				<VisualStateManager.VisualStateGroups>
					<VisualStateGroup x:Name="CommonStates">
						<VisualState x:Name="SingleAxes" />
						<VisualState x:Name="MultipleAxes">
							<Storyboard>
								<ObjectAnimationUsingKeyFrames Duration="0:0:0"
										Storyboard.TargetName="axesGroupRoot"
										Storyboard.TargetProperty="Visibility">
									<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
								</ObjectAnimationUsingKeyFrames>
							</Storyboard>
						</VisualState>
					</VisualStateGroup>
					<VisualStateGroup x:Name="MenuStates">
						<VisualState x:Name="Open">
							<Storyboard>
								<BooleanAnimationUsingKeyFrames Duration="0:0:0"
										Storyboard.TargetName="groupingPopupMenu"
										Storyboard.TargetProperty="IsOpen">
									<DiscreteBooleanKeyFrame Value="True" />
								</BooleanAnimationUsingKeyFrames>
							</Storyboard>
						</VisualState>
						<VisualState x:Name="Closed" />
					</VisualStateGroup>
				</VisualStateManager.VisualStateGroups>

				<Grid x:Name="groupIndicator" Width="18" Height="18">
					<Ellipse Stroke="Red" StrokeThickness="1" Fill="LightYellow" />
					<TextBlock Text="{Binding NumberOfCurves}" VerticalAlignment="Center"
							Foreground="Gray" HorizontalAlignment="Center" FontWeight="Bold" />
					<Popup x:Name="groupingPopupMenu" AllowsTransparency="True" Placement="Relative">
						<Border Background="LightYellow" BorderBrush="Red" BorderThickness="1"
								CornerRadius="3">
							<Button Margin="10"
									Content="{x:Static MultiLanguage:MlResources.UngroupAxes}"
									Style="{StaticResource PopupButtonStyle}"
									Command="{Binding UngroupCommand}" />
						</Border>
					</Popup>
				</Grid>
			</Grid>

			<Canvas Grid.RowSpan="10" Grid.Column="1">
				<Vertical:DynamicRulerLabel x:Name="DynamicRulerLabel" Visibility="Collapsed" />
			</Canvas>

			<!-- Curves (Rectangle Color) -->
			<ItemsControl ItemsSource="{Binding Curves}" Margin="0,0,0,10"
					VerticalAlignment="Center" Grid.Row="3">
				<ItemsControl.ItemTemplate>
					<DataTemplate>
						<Grid Background="{DynamicResource GeneralBackground}">
							<Hv:CurveRectControl Curve="{Binding}" Height="50" Margin="2" />
						</Grid>
					</DataTemplate>
				</ItemsControl.ItemTemplate>
			</ItemsControl>
		</Grid>

		<!-- Target for Scale Grouping -->
		<Grid x:Name="DropTarget" Visibility="Collapsed" Background="Transparent" />

	</Grid>

</UserControl>
